<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数组平铺算法</title>
	</head>
	<body>
		<script>
		function steamroller(arr) {
		    // I'm a steamroller, baby
			var newArr=[];
			for(var i=0;i<arr.length;i++){
				if(arr[i].length>0&&typeof arr[i]!="string"){
					var tArr=steamroller(arr[i]);
					for(var j=0;j<tArr.length;j++){
						newArr.push(tArr[j]);
					}
				}else if(arr[i].length==0){
				}
				else{
					newArr.push(arr[i]);
				}
			}
		    return newArr;
		}
 
		//document.write(steamroller([[["a"]], [["b"]]]));	
		var teatArr=[];
		testArr.push("a");
		document.write('<br>'+teatArr.length+teatArr);
		//document.write('<br>'+teatArr[0].length+teatArr[0]);
		</script>
	</body>
</html>
